package com.ruoyi.project.syl_DZ.D.OutpatientPatient.controller;

import java.util.List;

import com.ruoyi.project.syl_DZ.D.OutpatientPatient.domain.OutpatientDxyRegisterType;
import com.ruoyi.project.syl_DZ.D.OutpatientPatient.domain.OutpatientPatientDxy;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.project.syl_DZ.D.OutpatientPatient.service.IOutpatientPatientServiceDxy;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.project.syl_DZ.D.OutpatientPatient.domain.OutpatientRegisterGHD ;

/**
 * 【请填写功能名称】Controller
 *
 * @author ruoyi
 * @date 2021-07-16
 */
@RestController
@RequestMapping("/system/patient")
public class OutpatientDxyPatientController extends BaseController
{
    @Autowired
    private IOutpatientPatientServiceDxy outpatientPatientService;

    /**
     * 查询【请填写功能名称】列表
     */
    @PreAuthorize("@ss.hasPermi('system:type:list')")
    @GetMapping("/a/list")
    public TableDataInfo list(OutpatientDxyRegisterType outpatientRegisterType)
    {

        startPage();
        List<OutpatientDxyRegisterType> list = outpatientPatientService.selectOutpatientRegisterTypeList(outpatientRegisterType);
        return getDataTable(list);
    }



    /**
     * 查询【请填写功能名称】列表
     */
    @PreAuthorize("@ss.hasPermi('system:patient:list')")
    @GetMapping("/list")
    public TableDataInfo list(OutpatientPatientDxy outpatientPatient)
    {
        startPage();
        List<OutpatientPatientDxy> list = outpatientPatientService.selectOutpatientPatientList(outpatientPatient);
        return getDataTable(list);
    }
//    /**
//     * 查询nas列表
//     */
//    @PreAuthorize("@ss.hasPermi('system:patient:list2')")
//    @GetMapping("/b/list")
//    public TableDataInfo list03()
//    {
//        startPage();
//        List<OutpatientPatientDxy> list = outpatientPatientService.selectOutpatientPatientList03();
//        return getDataTable(list);
//    }

    /**
     * 导出【请填写功能名称】列表
     */
    @PreAuthorize("@ss.hasPermi('system:patient:export')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(OutpatientPatientDxy outpatientPatient)
    {
        List<OutpatientPatientDxy> list = outpatientPatientService.selectOutpatientPatientList(outpatientPatient);
        ExcelUtil<OutpatientPatientDxy> util = new ExcelUtil<OutpatientPatientDxy>(OutpatientPatientDxy.class);
        return util.exportExcel(list, "patient");
    }

    /**
     * 获取【请填写功能名称】详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:patient:query')")
    @GetMapping(value = "/{patientId}")
    public AjaxResult getInfo(@PathVariable("patientId") String patientIdcard)
    {
        AjaxResult success = AjaxResult.success(outpatientPatientService.selectOutpatientPatientById(patientIdcard));
        System.out.println(success);
        return success;
    }

    /**
     * 新增【请填写功能名称】
     */
    @PreAuthorize("@ss.hasPermi('system:patient:add')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody OutpatientPatientDxy outpatientPatient)
    {
        return toAjax(outpatientPatientService.insertOutpatientPatient(outpatientPatient));
    }

    /**
     * 修改【请填写功能名称】
     */
    @PreAuthorize("@ss.hasPermi('system:patient:edit')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody OutpatientPatientDxy outpatientPatient)
    {
        return toAjax(outpatientPatientService.updateOutpatientPatient(outpatientPatient));
    }

    /**
     * 删除【请填写功能名称】
     */
    @PreAuthorize("@ss.hasPermi('system:patient:remove')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
	@DeleteMapping("/{patientIds}")
    public AjaxResult remove(@PathVariable Long[] patientIds)
    {
        return toAjax(outpatientPatientService.deleteOutpatientPatientByIds(patientIds));
    }


}
